

package com.hazelcast.vector;

import com.hazelcast.spi.annotation.Beta;

import java.util.function.Function;

/**
 * {@link SearchOptions} hint definition
 *
 * @param <T>    type of hint value
 * @param name   hint name
 * @param parser hint value parser
 * @since 5.5
 */
@Beta
public record Hint<T>(String name, Function<String, T> parser) {
    public T get(SearchOptions options) {
        return parser.apply(options.getHints().get(name));
    }

    /**
     * @since 6.0
     */
    public boolean isPresent(SearchOptions options) {
        return options.getHints().containsKey(name);
    }
}
